From: Florian Müllner Date: Wed, 22 Oct 2025 01:30:41 +0000 (+0200) Subject: js: Use logErrorUnlessCancelled() helper X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~161 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f1cd8520b7c7f0f9ee2dbb57623bba972f2cfd2c;p=gnome-shell.git js: Use logErrorUnlessCancelled() helper Part-of: --- diff --git a/js/gdm/util.js b/js/gdm/util.js index 2d54ea25c..5d33837d9 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -8,6 +8,7 @@ import * as Batch from './batch.js'; import * as OVirt from './oVirt.js'; import * as Vmware from './vmware.js'; import * as Main from '../ui/main.js'; +import {logErrorUnlessCancelled} from '../misc/errorUtils.js'; import {loadInterfaceXML} from '../misc/fileUtils.js'; import * as Params from '../misc/params.js'; import * as SmartcardManager from '../misc/smartcardManager.js'; @@ -240,8 +241,7 @@ export class ShellUserVerifier extends Signals.EventEmitter { await this._handlePendingMessages(); this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null); } catch (e) { - if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) - logError(e); + logErrorUnlessCancelled(e); } } @@ -858,8 +858,7 @@ export class ShellUserVerifier extends Signals.EventEmitter { this._retry(serviceName); } } catch (e) { - if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) - logError(e); + logErrorUnlessCancelled(e); } } diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js index 59842dc57..3635fd30e 100644 --- a/js/misc/ibusManager.js +++ b/js/misc/ibusManager.js @@ -6,6 +6,7 @@ import Shell from 'gi://Shell'; import * as Signals from './signals.js'; import * as BoxPointer from '../ui/boxpointer.js'; +import {logErrorUnlessCancelled} from './errorUtils.js'; import * as IBusCandidatePopup from '../ui/ibusCandidatePopup.js'; @@ -172,11 +173,8 @@ class IBusManager extends Signals.EventEmitter { } this._updateReadiness(); } catch (e) { - if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) - return; - - logError(e); - this._clear(); + if (logErrorUnlessCancelled(e)) + this._clear(); } } @@ -185,10 +183,8 @@ class IBusManager extends Signals.EventEmitter { await this._ibus.request_name_async(IBus.SERVICE_PANEL, IBus.BusNameFlag.REPLACE_EXISTING, -1, this._cancellable); } catch (e) { - if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) { - logError(e); + if (logErrorUnlessCancelled(e)) this._clear(); - } return; } @@ -287,8 +283,7 @@ class IBusManager extends Signals.EventEmitter { this._MAX_INPUT_SOURCE_ACTIVATION_TIME, this._cancellable); } catch (e) { - if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) - logError(e); + logErrorUnlessCancelled(e); } } diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js index cc32f50bb..f15eb2e39 100644 --- a/js/misc/inputMethod.js +++ b/js/misc/inputMethod.js @@ -4,6 +4,7 @@ import Gio from 'gi://Gio'; import GObject from 'gi://GObject'; import IBus from 'gi://IBus'; +import {logErrorUnlessCancelled} from './errorUtils.js'; import * as Keyboard from '../ui/status/keyboard.js'; import * as Main from '../ui/main.js'; @@ -75,10 +76,8 @@ export const InputMethod = GObject.registerClass({ this._context = await this._ibus.create_input_context_async( 'gnome-shell', -1, this._cancellable); } catch (e) { - if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) { - logError(e); + if (logErrorUnlessCancelled(e)) this._clear(); - } return; }